//
//  WBNetworkManager.swift
//  weibo
//
//  Created by z先生 on 17/1/13.
//  Copyright © 2017年 SZT. All rights reserved.
//

import UIKit
import AFNetworking

//
enum WBHTTPMethod {
    
    case GET
    
    case POST
}
//网络管理数据
class WBNetworkManager: AFHTTPSessionManager {

    //在第一次访问时，执行闭包，并且将结果保存在shared常量里
    static let shared = WBNetworkManager()
    
    
    func request(method: WBHTTPMethod = .GET,URLString: String,parameters:[String: AnyObject],completion:@escaping (_ json: AnyObject?, _ isSuccess: Bool)->()){
        
        
        
        let success = { (task: URLSessionDataTask,json: AnyObject?)->() in
            
            completion(json, true)
            
        }
        
        let failure = { (task: URLSessionDataTask?,error: NSError)->() in
            
            print("网络请求错误\(error)")
            
            completion(nil,false)
            
        }
        
        
        if method == .GET {
            
            
            

        }else{
            
//            post(URLString, parameters: parameters, progress: nil, success: success, failure: failure)
            
        }
            }
    
    
}

extension WBNetworkManager{
    
    
}
